/*
 * AGENT SHERPA
 *  
 * Assignement 2 of the Agent Oriented Software Engineering Course
 * M.Sc. in Advanced Software Engineering (Part-time)
 * University College Dublin www.ucd.ie
 *
 * Copyright (c) 2007 Chris Walsh, Aidan Morrisy and Iain Hull.
 * All rights reserved.
 */

package org.agentsherpa;

import java.util.Map;

import org.agentsherpa.model.CellType;
import org.agentsherpa.model.Point;

import com.agentfactory.platform.interfaces.Actuator;
import com.agentfactory.platform.logic.FOS;
/**
 *
 * @author  Aidan
 */
public class CommunicateActuator extends Actuator {
    
    /** Creates a new instance of CommunicateActuator */
    public CommunicateActuator() {
        super();
    }
    
    public boolean act(FOS action) {
        
              
            LocationModule module = (LocationModule) getModuleByName("location");
            Map<Point, CellType> senses = module.sense();
            String roadTravelled = "";
            for (Point p : senses.keySet()) {
                   CellType type = senses.get(p);
                   String cellType = type.toString();
                   if (cellType.equals("Road")){
                        roadTravelled = roadTravelled + Integer.toString(p.getX()) + "," + Integer.toString(p.getY()) + ":";
                    }
                   adoptBelief("BELIEF(roadTravelled("+ roadTravelled + "))");
            }
            
        //Actuator Code goes here!
        return true;
        }
    

    }


